import Mock from 'mockjs'
export default [
    {
        url: '/api/login',
        method: 'post',

        response: ({ body }) => {
            console.log('100');
            const { username, password } = body
            if (username === 'admin' && password === 'admin') {
                return {
                    code: 200,
                    data: {
                        menu: [{
                            path: '/home',
                            name: 'home',
                            label: '首页',
                            icon: 'house',
                            url: 'home/home'
                        },
                        {
                            path: '/mall',
                            name: 'video',
                            label: '商品管理',
                            icon: 'video-play',
                            url: 'mall/index'
                        },
                        {
                            path: '/user',
                            name: 'user',
                            label: '用户管理',
                            icon: 'user',
                            url: 'user/index'
                        },
                        {
                            label: '其他',
                            icon: 'location',
                            children: [{
                                path: '/page1',
                                name: 'page1',
                                label: '页面1',
                                icon: 'setting',
                                url: 'page1'
                            },
                            {
                                path: '/page2',
                                name: 'page2',
                                label: '页面2',
                                icon: 'setting',
                                url: 'page2'
                            }
                            ]
                        }],
                        token: Mock.Random.guid(),
                        message: '获取成功'
                    }
                }
            } else if (username === 'admin' && password === '123') {
                return {
                    code: 200,
                    data: {
                        menu: [
                            {
                                path: '/home',
                                name: 'home',
                                label: '首页',
                                icon: 's-home',
                                url: 'home/home'
                            },
                            {
                                path: '/mall',
                                name: 'video',
                                label: '商品管理',
                                icon: 'video-play',
                                url: 'mall/index'
                            },
                        ]
                    }
                }
            } else {
                return {
                    code: -999,
                    data: {
                        message: '密码错误'
                    }
                }
            }

        }
    }
]